home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
p_serlib.sit
/
Serial Library Source Code
/
absorb_echo.c
next >
Wrap
Text File
|
1989-07-27
|
1KB
|
45 lines
/***********************************************************************/
/*
/* absorb_echo.c
/* by Atul Butte
/* Copyright ⌐ 1989 by Microsoft Corporation
/* All Rights Reserved
/*
/* version 1.0
/*
/*
/* This module provides a routine which will absorb a character
/* sent from the host.
/*
/***********************************************************************/
/***********************************************************************/
/*
/* absorb_echo
/*
/***********************************************************************/
OSErr absorb_echo( refIn, chCompare )
short refIn; /* reference number for input port */
char chCompare; /* character to compare against echo */
{
OSErr err; /* result code from Toolbox routines */
ParamBlockRec param; /* parameter block for read/write */
char ch; /* input character for echo */
param.ioParam.ioReqCount = 1;
param.ioParam.ioBuffer = &ch;
param.ioParam.ioRefNum = refIn;
err = PBRead( ¶m, false );
if( err != noErr ) {
return( errSerialRead );
}
if( ch != chCompare ) {
display_error( "Echoed character does not match character sent." );
}
return( noErr );
}